/**
 * Created by Administrator on 2016/12/31.
 */
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var shortid = require('shortid');
//保存当前时间的各种格式
var date = new Date();
var time = {
    date:date,
    year:date.getFullYear(),
    month:date.getFullYear() + '-' + (date.getMonth()+1),
    day:date.getFullYear() + '-' + (date.getMonth()+1) + '-' + date.getDate(),
    minute:date.getFullYear() + '-' + (date.getMonth()+1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + (date.getMinutes()<10 ? '0' + date.getMinutes() : date.getMinutes()),

}
var PostSchema = new Schema({
    _id :{type:String,unique:true,default:shortid.generate},
    selectName:{type:String,default:''},
    date:{type:String,default:time.minute},
    time:{type:Date,default:Date.now},
    users:{type:Object,default:{}},
    title:{type:String,default:''},
    phone:{type:String,default:''},
    price:{type:String,default:''},
    city:{type:String,default:''},
});
var Post = mongoose.model('Post',PostSchema);
module.exports = Post;